export default function showMiniAuth(scope,successCallBack){
	return new Promise((resolve, reject) => {
		uni.getSetting({
			success(res) {
				console.log('res:', res);
				console.log('scope:',scope,res.authSetting[scope])
				if (res.authSetting[scope]) {
					successCallBack();
				} else {
					uni.authorize({
						scope: scope,
						success(authorizeREs) {
							successCallBack();
						},
						fail(authorizeREs) {
							uni.showModal({
								title: '温馨提示',
								content: '请先授权定位权限',
								success: function(modalRes) {
									if (modalRes.confirm) {
									
										uni.openSetting({
											success(result) {
												if (result.authSetting[scope]) {
													
													resolve('授权成功');
												}
											},
											fail(error) {
												reject(error);
											}
										})
									} else if (res.cancel) {
										reject('授权取消');
									}
								}
							});
						},
					})
				}
			}
		})
	})
};